package com.cskaoyan.tk.mapstruct;

import com.cskaoyan.tk.bean.User;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring")
public interface UserConverter {


    @Mappings({
            @Mapping(source = "name",target = "username"),
            @Mapping(source = "age",target = "userage")
    })
    UserDto convertUserToDTO(User user);



    List<UserDto> convertUserListToDTOList(List<User> userList);


    // 把 多个对象转化为单个对象
    PersonDto convertToPersonDTO(User user,PersonDO personDO);

}
